package com.it.io;

public class StringIOSequence extends AbstractIOSequence<String, Character> {

	char[] result;
	
	@Override
	public void initInput(String input) {
		this.input = input;
	}

	@Override
	public boolean hasInput() {
		return inputIndex < input.length();
	}

	@Override
	public Character input() {
		return input.charAt(inputIndex++);
	}

	@Override
	public void initOutput(int size) {
		result = new char[size];
	}

	@Override
	public void output(Character e) {
		result[outputIndex++] = e;
	}

	@Override
	public String finish() {
		return new String(result);
	}

}